package com.zksk.admin.api;

import com.zksk.admin.api.factory.RemoteInvoiceRecordFallbackFactory;
import com.zksk.admin.api.factory.RemoteProductFallbackFactory;
import com.zksk.common.core.constant.SecurityConstants;
import com.zksk.common.core.constant.ServiceNameConstants;
import com.zksk.common.core.domain.R;
import com.zksk.mbg.admin.domain.MemberInvoiceRecord;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 开票记录信息相关模块
 */
@FeignClient(contextId = "RemoteInvoiceRecordService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteInvoiceRecordFallbackFactory.class)
public interface RemoteInvoiceRecordService {

    /**
     * 根据订单id查询开票记录信息
     * @param ordersId
     * @return
     */
    @GetMapping("/invoice/{ordersId}")
    public R<MemberInvoiceRecord> getByOrdersId(@PathVariable("ordersId") Long ordersId,
                                                @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 保存开票记录信息
     * @param memberInvoiceRecord
     * @return
     */
    @PostMapping("/invoice")
    public R<MemberInvoiceRecord> saveInvoiceRecord(@RequestBody MemberInvoiceRecord memberInvoiceRecord,
                                                    @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
